Option Explicit
dim exepath : exepath = "firefox.exe"
Dim doc
Set doc = application.ActiveDocument
call GetUserLicence(doc)
main
sub main()
	dim ds_path
	dim wsh
	set wsh = createobject("wscript.shell")
	dim cmps,cmp
	set cmps = doc.components(1)	
	for each cmp in cmps
		'msgbox cmp.partname
		'https://info.paxsz.com/RDAndEngineer/BOM/BomIntegratedQuery.aspx?Invcode=300501010000123&tagid=2
		ds_path = exepath & " https://info.paxsz.com/RDAndEngineer/BOM/BomIntegratedQuery.aspx?Invcode=" & cmp.partname & "&tagid=2"
		wsh.run(ds_path)
	next
	set wsh= nothing
end sub

'#######################################################
'#######################################################
'#######################################################
' Function to validate document
Private Function ValidateServer(docObj)
    Dim key, licenseServer, licenseToken
    key = docObj.Validate(0)
    Set licenseServer = CreateObject("MGCPCBAutomationLicensing.Application")
    licenseToken = licenseServer.GetToken(key)
    Set licenseServer = nothing
    'On Error Resume Next
    Err.Clear
    docObj.Validate(licenseToken)
    If Err Then
        ValidateServer = 0    
    Else 
        ValidateServer = 1
    End If
End Function

sub GetUserLicence(docObj)

	If ValidateServer(docObj) = 0 Then
	    msgbox "Server validation failed."
	    exit sub
	End If
	
end sub